import java.util.Scanner;
//移除字符串相邻相同元素
public class code3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        StringBuilder sb = new StringBuilder();
        int fag=0;
        for(char ch:str.toCharArray()) {
            if (fag!=0&&ch == str.charAt(fag-1)) {
                sb.deleteCharAt(fag-1);
                fag--;
            } else {
                sb.append(ch);
                fag++;
            }
        }
        if(sb.length()!=0) {
            System.out.println(sb);
        } else {
            System.out.println(0);
        }

    }
}
